package by.bsu.touragency.db.beans;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class InformationClient {
	private int id;
	private int clientId;
	private String FIO;
	private String passport;
	private String tel;

	public InformationClient() {
		super();
	}

	public InformationClient(String fIO, String passport, String tel) {
		super();
		FIO = fIO;
		this.passport = passport;
		this.tel = tel;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getFIO() {
		return FIO;
	}

	public void setFIO(String fIO) {
		FIO = fIO;
	}

	public String getPassport() {
		return passport;
	}

	public void setPassport(String passport) {
		this.passport = passport;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public boolean isValidTel(String tel) {
		if (tel != "" && tel != null && tel.length() < 20) {
			Pattern p = Pattern.compile("\\+*\\d+");
			Matcher m = p.matcher(tel);
			return m.matches();
		} else
			return false;
	}

	public boolean isValidPassport(String pas) {
		if (pas != "" && pas != null && pas.length() < 20) {
			Pattern p = Pattern.compile("\\w+");
			Matcher m = p.matcher(pas);
			return m.matches();
		} else
			return false;
	}

	public boolean isValidFIO(String fio) {
		if (fio != "" & fio != null && fio.length() < 50) {
			Pattern p = Pattern.compile("(([A-Z])*([a-z])+)+");
			Matcher m = p.matcher(fio);
			return m.matches();
		} else
			return false;
	}

	public int getClientId() {
		return clientId;
	}

	public void setClientId(int clientId) {
		this.clientId = clientId;
	}
}
